```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>FastAPI-MCP | 无缝连接FastAPI与AI代理</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f8fafc;
            color: #1e293b;
            scroll-behavior: smooth;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .feature-icon {
            width: 60px;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 16px;
            margin-bottom: 1.5rem;
            background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
            color: white;
            font-size: 1.5rem;
        }
        .drop-cap:first-letter {
            float: left;
            font-size: 3.5rem;
            line-height: 1;
            margin-right: 0.75rem;
            margin-top: 0.25rem;
            color: #6366f1;
            font-weight: 700;
        }
        .mermaid {
            background-color: white;
            border-radius: 0.75rem;
            padding: 1.5rem;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 md:py-32 px-4 md:px-0">
        <div class="container mx-auto max-w-6xl px-4">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-6xl font-bold mb-4 leading-tight">FastAPI-MCP</h1>
                    <h2 class="text-xl md:text-2xl font-medium mb-6 opacity-90">无缝连接FastAPI与AI代理的桥梁</h2>
                    <p class="text-lg mb-8 opacity-90 max-w-lg">将您的FastAPI端点自动转换为AI可理解的MCP工具，无需复杂配置，即刻体验AI驱动的API交互。</p>
                    <div class="flex flex-wrap gap-4">
                        <a href="#getting-started" class="bg-white text-indigo-600 hover:bg-gray-100 px-6 py-3 rounded-lg font-semibold text-lg transition duration-300">
                            快速开始 <i class="fas fa-arrow-right ml-2"></i>
                        </a>
                        <a href="https://github.com/tadata-org/fastapi_mcp" target="_blank" class="border-2 border-white text-white hover:bg-white hover:text-indigo-600 px-6 py-3 rounded-lg font-semibold text-lg transition duration-300">
                            <i class="fab fa-github mr-2"></i> GitHub
                        </a>
                    </div>
                </div>
                <div class="md:w-1/2 flex justify-center">
                    <div class="bg-white p-2 rounded-xl shadow-2xl max-w-md">
                        <img src="https://cdn.nlark.com/yuque/0/2025/png/21449790/1755415726912-344e5d0e-cbdb-4e1b-830d-50ffa1e042dc.png" alt="FastAPI-MCP 架构图" class="rounded-lg w-full">
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Problem & Solution Section -->
    <section class="py-16 bg-white">
        <div class="container mx-auto max-w-6xl px-4">
            <div class="text-center mb-16">
                <h2 class="text-3xl md:text-4xl font-bold mb-4 text-gray-800">它能解决什么问题</h2>
                <div class="w-24 h-1 bg-indigo-500 mx-auto"></div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div class="drop-cap bg-gray-50 p-8 rounded-xl">
                    <p class="text-lg text-gray-700 leading-relaxed">
                        开发者和企业常常面临将现有 API 与 AI 代理集成的挑战。传统方法需要手动编写中间层代码或使用复杂的 OpenAPI 到 MCP 转换工具，这不仅耗时，还可能导致认证、文档或架构不一致的问题。此外，许多工具配置复杂，缺乏对 FastAPI 原生功能的支持，开发者需要额外学习新框架或调整现有代码。
                    </p>
                </div>
                <div class="bg-indigo-50 p-8 rounded-xl border-l-4 border-indigo-500">
                    <h3 class="text-xl font-bold mb-4 text-indigo-700">FastAPI-MCP 的解决方案</h3>
                    <p class="text-gray-700 leading-relaxed">
                        通过原生集成 FastAPI，将端点自动转换为 MCP 工具，保留原有认证机制和文档，极大简化了 AI 与 API 的交互流程，同时保持高效和低配置需求。无需额外学习新框架，使用您熟悉的 FastAPI 即可实现 AI 集成。
                    </p>
                </div>
            </div>
        </div>
    </section>

    <!-- Features Section -->
    <section class="py-16 bg-gray-50">
        <div class="container mx-auto max-w-6xl px-4">
            <div class="text-center mb-16">
                <h2 class="text-3xl md:text-4xl font-bold mb-4 text-gray-800">核心功能概述</h2>
                <p class="text-xl text-gray-600 max-w-2xl mx-auto">FastAPI-MCP 提供了一系列强大功能，简化从 FastAPI 到 MCP 的转换过程</p>
                <div class="w-24 h-1 bg-indigo-500 mx-auto mt-4"></div>
            </div>
            
            <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-8">
                <div class="bg-white card-hover p-8 rounded-xl shadow-sm">
                    <div class="feature-icon">
                        <i class="fas fa-exchange-alt"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">自动端点转换</h3>
                    <p class="text-gray-600">自动将 FastAPI 端点转换为 MCP 工具，保留请求和响应模型的架构，无需手动重新定义。</p>
                </div>
                
                <div class="bg-white card-hover p-8 rounded-xl shadow-sm">
                    <div class="feature-icon">
                        <i class="fas fa-lock"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">内置认证支持</h3>
                    <p class="text-gray-600">利用 FastAPI 的 Depends() 机制，支持 OAuth 2.1 等 MCP 标准认证，轻松实现安全的工具调用。</p>
                </div>
                
                <div class="bg-white card-hover p-8 rounded-xl shadow-sm">
                    <div class="feature-icon">
                        <i class="fas fa-bolt"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">ASGI 高效通信</h3>
                    <p class="text-gray-600">通过 FastAPI 的 ASGI 接口直接通信，消除额外的 HTTP 调用，提升性能。</p>
                </div>
                
                <div class="bg-white card-hover p-8 rounded-xl shadow-sm">
                    <div class="feature-icon">
                        <i class="fas fa-magic"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">零配置启动</h3>
                    <p class="text-gray-600">只需三行代码即可将 MCP 服务器挂载到现有 FastAPI 应用，减少设置时间。</p>
                </div>
                
                <div class="bg-white card-hover p-8 rounded-xl shadow-sm">
                    <div class="feature-icon">
                        <i class="fas fa-server"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">灵活部署选项</h3>
                    <p class="text-gray-600">支持将 MCP 服务器挂载到同一 FastAPI 应用或独立部署，适应不同场景需求。</p>
                </div>
                
                <div class="bg-white card-hover p-8 rounded-xl shadow-sm">
                    <div class="feature-icon">
                        <i class="fas fa-book"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">文档保留</h3>
                    <p class="text-gray-600">完整保留 FastAPI 端点的 Swagger 文档和 Pydantic 模型架构，确保 AI 准确理解工具功能。</p>
                </div>
            </div>
        </div>
    </section>

    <!-- Visualization Section -->
    <section class="py-16 bg-white">
        <div class="container mx-auto max-w-6xl px-4">
            <div class="text-center mb-16">
                <h2 class="text-3xl md:text-4xl font-bold mb-4 text-gray-800">FastAPI-MCP 工作流程</h2>
                <p class="text-xl text-gray-600 max-w-2xl mx-auto">了解 FastAPI-MCP 如何将您的 API 转换为 AI 可理解的工具</p>
                <div class="w-24 h-1 bg-indigo-500 mx-auto mt-4"></div>
            </div>
            
            <div class="mermaid">
                graph TD
                    A[现有 FastAPI 应用] --> B[FastAPI-MCP 中间件]
                    B --> C[自动转换为 MCP 工具]
                    C --> D{部署选项}
                    D --> E[同一 FastAPI 应用]
                    D --> F[独立 MCP 服务器]
                    C --> G[保留认证机制]
                    C --> H[保留文档结构]
                    C --> I[支持多种传输协议]
                    E --> J[AI 代理调用]
                    F --> J
                    J --> K[自然语言交互]
                    J --> L[程序化调用]
            </div>
        </div>
    </section>

    <!-- Use Cases Section -->
    <section class="py-16 bg-gray-50">
        <div class="container mx-auto max-w-6xl px-4">
            <div class="text-center mb-16">
                <h2 class="text-3xl md:text-4xl font-bold mb-4 text-gray-800">使用场景</h2>
                <p class="text-xl text-gray-600 max-w-2xl mx-auto">FastAPI-MCP 适用于多种实际应用场景</p>
                <div class="w-24 h-1 bg-indigo-500 mx-auto mt-4"></div>
            </div>
            
            <div class="grid md:grid-cols-3 gap-8">
                <div class="bg-white card-hover p-8 rounded-xl shadow-sm">
                    <div class="text-indigo-500 text-4xl mb-4">
                        <i class="fas fa-robot"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">API 驱动的 AI 助手</h3>
                    <p class="text-gray-600 mb-4">将天气数据API暴露为MCP工具，AI代理通过自然语言查询数据，如"告诉我伦敦今天的天气"。</p>
                    <div class="bg-indigo-50 p-4 rounded-md border border-indigo-100">
                        <code class="text-sm text-indigo-700">GET /weather?location=London</code>
                    </div>
                </div>
                
                <div class="bg-white card-hover p-8 rounded-xl shadow-sm">
                    <div class="text-indigo-500 text-4xl mb-4">
                        <i class="fas fa-project-diagram"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">自动化工作流集成</h3>
                    <p class="text-gray-600 mb-4">将内部API转化为MCP工具，AI自动执行任务，如"创建新用户"调用/users/create端点完成注册。</p>
                    <div class="bg-indigo-50 p-4 rounded-md border border-indigo-100">
                        <code class="text-sm text-indigo-700">POST /users/create {name: "Alice"}</code>
                    </div>
                </div>
                
                <div class="bg-white card-hover p-8 rounded-xl shadow-sm">
                    <div class="text-indigo-500 text-4xl mb-4">
                        <i class="fas fa-lightbulb"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-3 text-gray-800">快速原型开发</h3>
                    <p class="text-gray-600 mb-4">快速将CRUD API转化为MCP工具，用于AI交互演示，如动态操作数据。</p>
                    <div class="bg-indigo-50 p-4 rounded-md border border-indigo-100">
                        <code class="text-sm text-indigo-700">"查找价格超过100元的订单"</code>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Getting Started Section -->
    <section id="getting-started" class="py-16 bg-white">
        <div class="container mx-auto max-w-6xl px-4">
            <div class="text-center mb-16">
                <h2 class="text-3xl md:text-4xl font-bold mb-4 text-gray-800">上手指南</h2>
                <p class="text-xl text-gray-600 max-w-2xl mx-auto">快速开始使用 FastAPI-MCP 的步骤</p>
                <div class="w-24 h-1 bg-indigo-500 mx-auto mt-4"></div>
            </div>
            
            <div class="bg-gray-50 rounded-xl p-8">
                <div class="grid md:grid-cols-2 gap-8">
                    <div>
                        <h3 class="text-xl font-bold mb-6 text-gray-800 flex items-center">
                            <span class="bg-indigo-500 text-white rounded-full w-8 h-8 flex items-center justify-center mr-3">1</span>
                            安装依赖
                        </h3>
                        <div class="bg-gray-800 rounded-lg p-4 mb-6">
                            <pre class="text-green-400 text-sm overflow-x-auto">pip install fastapi-mcp</pre>
                        </div>
                        <p class="text-gray-600 mb-6">或使用 UV 安装：</p>
                        <div class="bg-gray-800 rounded-lg p-4">
                            <pre class="text-green-400 text-sm overflow-x-auto">uv add fastapi-mcp</pre>
                        </div>
                    </div>
                    
                    <div>
                        <h3 class="text-xl font-bold mb-6 text-gray-800 flex items-center">
                            <span class="bg-indigo-500 text-white rounded-full w-8 h-8 flex items-center justify-center mr-3">2</span>
                            创建FastAPI应用
                        </h3>
                        <div class="bg-gray-800 rounded-lg p-4">
                            <pre class="text-green-400 text-sm overflow-x-auto">from fastapi import FastAPI
app = FastAPI()

@app.get("/ping")
async def ping():
    return {"pong": True}</pre>
                        </div>
                    </div>
                </div>
                
                <div class="mt-8">
                    <h3 class="text-xl font-bold mb-6 text-gray-800 flex items-center">
                        <span class="bg-indigo-500 text-white rounded-full w-8 h-8 flex items-center justify-center mr-3">3</span>
                        集成FastAPI-MCP
                    </h3>
                    <div class="bg-gray-800 rounded-lg p-4">
                        <pre class="text-green-400 text-sm overflow-x-auto">from fastapi_mcp import FastApiMCP
mcp = FastApiMCP(app)
mcp.mount_http()  # 使用推荐的HTTP传输</pre>
                    </div>
                </div>
                
                <div class="mt-8">
                    <h3 class="text-xl font-bold mb-6 text-gray-800 flex items-center">
                        <span class="bg-indigo-500 text-white rounded-full w-8 h-8 flex items-center justify-center mr-3">4</span>
                        连接MCP客户端
                    </h3>
                    <div class="bg-gray-800 rounded-lg p-4">
                        <pre class="text-green-400 text-sm overflow-x-auto"># 在Cursor中配置
设置 > MCP > 添加服务器: http://localhost:8000/mcp

# 或在Claude Desktop配置文件中添加
{
  "mcpServers": {
    "my-api-mcp": {
      "command": "mcp-proxy",
      "args": ["http://127.0.0.1:8000/mcp"]
    }
  }
}</pre>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Advantages Section -->
    <section class="py-16 bg-indigo-50">
        <div class="container mx-auto max-w-6xl px-4">
            <div class="text-center mb-16">
                <h2 class="text-3xl md:text-4xl font-bold mb-4 text-gray-800">优势与特色</h2>
                <p class="text-xl text-gray-600 max-w-2xl mx-auto">为何选择 FastAPI-MCP</p>
                <div class="w-24 h-1 bg-indigo-500 mx-auto mt-4"></div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white p-8 rounded-xl shadow-sm">
                    <h3 class="text-xl font-bold mb-4 text-indigo-600">核心优势</h3>
                    <ul class="space-y-4">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-indigo-500 mt-1 mr-3"></i>
                            <span class="text-gray-700">FastAPI 原生集成，无需复杂中间层</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-indigo-500 mt-1 mr-3"></i>
                            <span class="text-gray-700">完整保留文档与架构，确保AI准确理解</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-indigo-500 mt-1 mr-3"></i>
                            <span class="text-gray-700">支持多种传输协议(HTTP/SSE)，适应不同需求</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-indigo-500 mt-1 mr-3"></i>
                            <span class="text-gray-700">活跃社区支持(7.2k星标)，定期更新改进</span>
                        </li>
                    </ul>
                </div>
                
                <div class="bg-white p-8 rounded-xl shadow-sm">
                    <h3 class="text-xl font-bold mb-4 text-indigo-600">技术规格</h3>
                    <ul class="space-y-4 text-gray-700">
                        <li><strong>许可证：</strong> MIT 开源</li>
                        <li><strong>Python版本：</strong> 3.10+ (推荐3.12)</li>
                        <li><strong>依赖：</strong> FastAPI 0.115.9+, Pydantic 2.11.5+, MCP 1.9.1+</li>
                        <li><strong>包管理器：</strong> UV(推荐) 或 pip</li>
                        <li><strong>可选组件：</strong> MCP 客户端(Cursor/Claude Desktop)</li>
                    </ul>
                    
                    <div class="mt-6 p-4 bg-indigo-100 rounded-lg">
                        <h4 class="font-bold mb-2 text-indigo-700">思考问题</h4>
                        <p class="text-gray-700">您的开发环境是否已满足 FastAPI-MCP 的依赖要求？是否需要托管服务来简化部署？</p>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // Smooth scroll for anchor links
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>
```